from django.db import models

from course.models import Course
from home.utils.BaseModel import BaseModel
from user.models import User


# Create your models here.
class Cart(BaseModel):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    course = models.ForeignKey(Course, on_delete=models.CASCADE)
    selected = models.BooleanField(default=True)

    class Meta:
        db_table = 'cart'

    def __str__(self):
        return str(self.id)


class Comments(BaseModel):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    course = models.ForeignKey(Course, on_delete=models.CASCADE)
    content = models.CharField(max_length=500, default='')

    class Meta:
        db_table = 'comments'

    def __str__(self):
        return str(self.id)
